package com.itheima.springbootcondition;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import com.itheima.springbootcondition.pojo.User;

@SpringBootApplication//引导类扫描该包及其子包下
public class SpringbootConditionApplication {

    public static void main(String[] args) {

        //主函数调用的run方法是有返回值的，其实是上下文环境对象
        ConfigurableApplicationContext context = SpringApplication.run(SpringbootConditionApplication.class, args);
        //通过IOC容器或许对象,前提是该项目中是引入了redis起始坐标依赖的，AutoConfigure实现
        Object redistemplate = context.getBean("redisTemplate");
        System.out.println(redistemplate);

        //获取user对象
        Object user = context.getBean(User.class);
        System.out.println(user);
        //获取user对象
        Object user2 = context.getBean("user2");
        System.out.println(user2);
    }

}
